package com.xiaomiMall.mange.controller;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.xiaomiMall.mange.domain.MallRegisterBody;
import com.xiaomiMall.mange.service.MallRegisterService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api")
public class MallRegisterController extends BaseController {

    @Resource
    private MallRegisterService mallRegisterService;

    // 注册的controller
    @PostMapping("/register")
    public AjaxResult register(@RequestBody MallRegisterBody register) {
        String msg = mallRegisterService.register(register);
        return StringUtils.isEmpty(msg) ? success() : error(msg);
    }

}
